//
//  HYBaseTableViewController.h
//  HYNeiHan
//
//  Created by 上官惠阳 on 16/9/26.
//  Copyright © 2016年 上官惠阳. All rights reserved.
//

#import "HYBaseViewController.h"
#import "HYBaseTableViewCell.h"
#import "HYBaseTableView.h"

typedef void(^HYTableVcCellSelectedHandle)(HYBaseTableViewCell *cell, NSIndexPath *indexPath);

typedef NS_ENUM(NSUInteger, HYBaseTableVcRefreshType) {
    /** 无法刷新*/
    HYBaseTableVcRefreshTypeNone = 0,
    /** 只能刷新*/
    HYBaseTableVcRefreshTypeOnlyCanRefresh,
    /** 只能上拉加载*/
    HYBaseTableVcRefreshTypeOnlyCanLoadMore,
    /** 能刷新也能上拉加载*/
    HYBaseTableVcRefreshTypeRefreshAndLoadMore
};
@interface HYBaseTableViewController : HYBaseViewController<UITableViewDelegate,UITableViewDataSource>
{
    NSMutableArray *_dataArray;
}
/** 刚才执行的是刷新*/
@property (nonatomic, assign) NSInteger isRefresh;

/** 刚才执行的是上拉加载*/
@property (nonatomic, assign) NSInteger isLoadMore;

/** 添加空界面文字*/
- (void)HY_addEmptyPageWithText:(NSString *)text;

/** 表视图*/
@property (nonatomic, weak) HYBaseTableView *tableView;

/** 表视图偏移*/
@property (nonatomic, assign) UIEdgeInsets tableEdgeInset;

/** 分割线颜色*/
@property (nonatomic, assign) UIColor *sepLineColor;

/** 数据源数量*/
@property (nonatomic, strong) NSMutableArray *dataArray;

/** 加载刷新类型*/
@property (nonatomic, assign) HYBaseTableVcRefreshType refreshType;

/** 是否需要系统的cell的分割线*/
@property (nonatomic, assign) BOOL needCellSepLine;

/** 刷新数据*/
- (void)HY_reloadData;

/** 开始下拉*/
- (void)HY_beginRefresh;

/** 停止刷新*/
- (void)HY_endRefresh;

/** 停止上拉加载*/
- (void)HY_endLoadMore;

/** 隐藏刷新*/
- (void)HY_hiddenRrefresh;

/** 隐藏上拉加载*/
- (void)HY_hiddenLoadMore;

/** 提示没有更多信息*/
- (void)HY_noticeNoMoreData;

/** 配置数据*/
- (void)HY_commonConfigResponseWithResponse:(id)response isRefresh:(BOOL)isRefresh modelClass:(__unsafe_unretained Class)modelClass;

/** 配置数据*/
- (void)HY_commonConfigResponseWithResponse:(id)response isRefresh:(BOOL)isRefresh modelClass:(__unsafe_unretained Class)modelClass emptyText:(NSString *)emptyText;

/** 是否在下拉刷新*/
@property (nonatomic, assign, readonly) BOOL isHeaderRefreshing;

/** 是否在上拉加载*/
@property (nonatomic, assign, readonly) BOOL isFooterRefreshing;

#pragma mark - 子类去重写
/** 分组数量*/
- (NSInteger)HY_numberOfSections;

/** 某个分组的cell数量*/
- (NSInteger)HY_numberOfRowsInSection:(NSInteger)section;

/** 某行的cell*/
- (HYBaseTableViewCell *)HY_cellAtIndexPath:(NSIndexPath *)indexPath;

/** 点击某行*/
- (void)HY_didSelectCellAtIndexPath:(NSIndexPath *)indexPath cell:(HYBaseTableViewCell *)cell;

/** 某行行高*/
- (CGFloat)HY_cellheightAtIndexPath:(NSIndexPath *)indexPath;

/** 某个组头*/
- (UIView *)HY_headerAtSection:(NSInteger)section;

/** 某个组尾*/
- (UIView *)HY_footerAtSection:(NSInteger)section;

/** 某个组头高度*/
- (CGFloat)HY_sectionHeaderHeightAtSection:(NSInteger)section;

/** 某个组尾高度*/
- (CGFloat)HY_sectionFooterHeightAtSection:(NSInteger)section;

/** 分割线偏移*/
- (UIEdgeInsets)HY_sepEdgeInsetsAtIndexPath:(NSIndexPath *)indexPath;

#pragma mark - 子类去继承
/** 刷新方法*/
- (void)HY_refresh;

/** 上拉加载方法*/
- (void)HY_loadMore;

@property (nonatomic, assign) BOOL showRefreshIcon;

- (void)endRefreshIconAnimation;

@property (nonatomic, weak, readonly) UIView *refreshHeader;

#pragma mark - loading & alert
- (void)HY_showLoading;

- (void)HY_hiddenLoading;

- (void)HY_showTitle:(NSString *)title after:(NSTimeInterval)after;
@end
